package linwen.wang.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import linwen.wang.plugin.DynamicDataSourcePlugin;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName MybatisPluginConfig
 * @Description TODO
 * @Author zero
 * @DATE 2024/6/4 11:17 PM
 * @Version 1.0
 */

@Configuration
public class MybatisPluginConfig {
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        // 添加分页插件等其他内建插件...
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        // 添加自定义插件
        interceptor.addInnerInterceptor(new DynamicDataSourcePlugin());
        return interceptor;
    }
}
